package ph.com.gs3.formalistics.model.tables;

public class OutgoingStarMarksTable extends AbstractDataTable {

	public static final String NAME = "Outgoing_Star_Marks";
	public static final String DOCUMENTS_TABLE_NAME = DocumentsTable.NAME;

	public static final String COL_ID = "id";
	public static final String COL_DOCUMENT_DB_ID = "document_db_id";
	public static final String COL_IS_STARRED = "is_starred";
	public static final String COL_ISSUED_BY_USER_DB_ID = "issued_by_user_db_id";
	public static final String COL_DATE_ISSUED = "date_issued";

	// @formatter:off
	public static final String[] JOINED_WITH_DOCUMENT_STAR_COLUMNS = {
		NAME + "."  + COL_ID, 
		NAME + "."  + COL_DOCUMENT_DB_ID, 
		NAME + "."  + COL_IS_STARRED,
		NAME + "."  + COL_ISSUED_BY_USER_DB_ID, 
		NAME + "."  + COL_DATE_ISSUED,
		DOCUMENTS_TABLE_NAME + "." + DocumentsTable.COL_IS_STARRED		
	};
	// @formatter:on

	@Override
	public String[] getTableColumns() {
		return new String[] { COL_ID, COL_DOCUMENT_DB_ID, COL_IS_STARRED, COL_ISSUED_BY_USER_DB_ID,
		        COL_DATE_ISSUED };
	}

	@Override
	protected String getCreateTableQuery() {
		// @formatter:off
		return 	"CREATE TABLE " 	+ NAME 	+ "(" 
				+ COL_ID 					+ " INTEGER PRIMARY KEY AUTOINCREMENT, "
				+ COL_DOCUMENT_DB_ID 		+ " TEXT NOT NULL, "
				+ COL_IS_STARRED 			+ " TEXT NOT NULL, "
				+ COL_ISSUED_BY_USER_DB_ID 	+ " TEXT NOT NULL, "
				+ COL_DATE_ISSUED 			+ " TEXT NOT NULL"
				+ "); ";
		// @formatter:on

	}

	@Override
	protected String getTableName() {
		return NAME;
	}

}
